-module(erlapi_app).

-behaviour(application).

-export([start/2, stop/1]).


%%%===================================================================
%%% Application callbacks
%%%===================================================================

start(_StartType, _StartArgs) ->
    token:init(),

    ehttp:start(#{ref => ?MODULE, port => 8888, routes => erlapi_route:get(), middles => [ehttp_middle_logger, ehttp_middle_cors]}),

    erlapi_sup:start_link().

stop(_State) ->
    ehttp:stop(?MODULE),
    ok.
